﻿@model BlogPostModel

@using Telerik.Web.Mvc.UI;
@Html.ValidationSummary(false)
@Html.HiddenFor(model => model.Id)
@Html.SmartStore().TabStrip().Name("blog-post-edit").Style(TabsStyle.Material).Items(x =>
{
    x.Add().Text(T("Admin.ContentManagement.Blog.BlogPosts.Info").Text)
		.Content(TabInfo())
		.Selected(true);

    x.Add().Text(T("Admin.Common.SEO").Text)
		.Content(TabSeo());

	x.Add().Text(T("Admin.Common.Stores").Text)
		.Content(TabStores());

    //generate an event
    EngineContext.Current.Resolve<IEventPublisher>().Publish(new TabStripCreated(x, "blog-post-edit", this.Html, this.Model));
})

@helper TabInfo()
{
    <table class="adminContent">
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.LanguageId)
            </td>
            <td class="adminData">
                @Html.DropDownListFor(model => model.LanguageId, new SelectList(ViewBag.AllLanguages, "Id", "Name"))
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.Title)
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.Title)
                @Html.ValidationMessageFor(model => model.Title)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.Body)
            </td>
            <td class="adminData wide">
                @Html.EditorFor(x => x.Body, "Html")
                @Html.ValidationMessageFor(model => model.Body)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.AllowComments)
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.AllowComments)
                @Html.ValidationMessageFor(model => model.AllowComments)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.Tags)
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.Tags)
                @Html.ValidationMessageFor(model => model.Tags)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.StartDate)
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.StartDate)
                @Html.ValidationMessageFor(model => model.StartDate)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.EndDate)
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.EndDate)
                @Html.ValidationMessageFor(model => model.EndDate)
            </td>
        </tr>
		<tr>
			<td class="adminTitle">
				@Html.SmartLabelFor(model => model.CreatedOnUtc)
			</td>
			<td class="adminData">
                @Html.EditorFor(model => model.CreatedOnUtc)
                @Html.ValidationMessageFor(model => model.CreatedOnUtc)
			</td>
		</tr>
    </table>
}
@helper TabSeo()
{
    <table class="adminContent">
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.MetaKeywords)
            </td>
            <td class="adminData">
                @Html.EditorFor(x => x.MetaKeywords)
                @Html.ValidationMessageFor(model => model.MetaKeywords)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.MetaDescription)
            </td>
            <td class="adminData">
                @Html.EditorFor(x => x.MetaDescription)
                @Html.ValidationMessageFor(model => model.MetaDescription)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.MetaTitle)
            </td>
            <td class="adminData">
                @Html.EditorFor(x => x.MetaTitle)
                @Html.ValidationMessageFor(model => model.MetaTitle)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.SeName)
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.SeName)
				@if (Model.Id != 0)
                {
                    @Html.Action("NamesPerEntity", "UrlRecord", new { entityName = "BlogPost", entityId = Model.Id })
                }
                @Html.ValidationMessageFor(model => model.SeName)
            </td>
        </tr>
    </table>
}

@helper TabStores()
{
	@Html.Partial("StoreSelector", Model)
}
